package homework12月9号补交.homework2.d7;

import java.lang.reflect.Method;

public class test {
    public static void main(String[] args) throws Exception {
        Class<?> aClass = Class.forName("czxy.homework2.d7.Person");
        Method setName = aClass.getDeclaredMethod("setName", String.class);
        setName.setAccessible(true);
        Person person = (Person) aClass.newInstance();
        setName.invoke(person,"123");
        String name = person.getName();
        System.out.println(name);
    }
}
